home *** CD-ROM | disk | FTP | other *** search
/ 17 Bit Software 6: Level 6 / 17 Bit - Level 6 (1998)(Epic Marketing)[!].iso / quartz / q0429.dms / q0429.adf / libray / libtext / fbmbump.c < prev    next >
C/C++ Source or Header  |  1991-08-08  |  1KB  |  53 lines

  1. /*
  2.  * fbmbump.c
  3.  *
  4.  * Copyright (C) 1989, 1991, Craig E. Kolb
  5.  * All rights reserved.
  6.  *
  7.  * This software may be freely copied, modified, and redistributed
  8.  * provided that this copyright notice is preserved on all copies.
  9.  *
  10.  * You may not distribute this software, in whole or in part, as part of
  11.  * any commercial product without the express consent of the authors.
  12.  *
  13.  * There is no warranty or other guarantee of fitness of this software
  14.  * for any purpose.  It is provided solely "as is".
  15.  *
  16.  * $Id: fbmbump.c,v 4.0 91/07/17 14:42:21 kolb Exp Locker: kolb $
  17.  *
  18.  * $Log:    fbmbump.c,v $
  19.  * Revision 4.0  91/07/17  14:42:21  kolb
  20.  * Initial version.
  21.  * 
  22.  */
  23. #include "texture.h"
  24. #include "fbm.h"
  25. #include "fbmbump.h"
  26.  
  27. FBm *
  28. FBmBumpCreate(offset, scale, h, lambda, octaves)
  29. Float offset, h, lambda, scale;
  30. int octaves;
  31. {
  32.     FBm *fbm;
  33.     fbm = FBmCreate(offset, scale, h, lambda, octaves, 0., (char *)NULL);
  34.     return fbm;
  35. }
  36.  
  37. /*ARGSUSED*/
  38. void
  39. FBmBumpApply(fbm, prim, ray, pos, norm, gnorm, surf)
  40. FBm *fbm;
  41. Geom *prim;
  42. Ray *ray;
  43. Vector *pos, *norm, *gnorm;
  44. Surface *surf;
  45. {
  46.     Vector disp;
  47.  
  48.     VfBm(pos, fbm->omega, fbm->lambda, fbm->octaves, &disp);
  49.     norm->x += fbm->offset + disp.x * fbm->scale;
  50.     norm->y += fbm->offset + disp.y * fbm->scale;
  51.     norm->z += fbm->offset + disp.z * fbm->scale;
  52. }
  53.